<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *留言记录
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$tabs=array(
	array('op'=>'list','title'=>'置顶列表'),
);
$return['status']=$this->joblog_status;
if($_RQ['op']=='list'){
	$type=intval($_RQ['type']);
	$params=array('uniacid'=>$_SESSION['uniacid']);
	if($_RQ['jobtitle']){
		$params2=array('uniacid'=>$_SESSION['uniacid']);
		$params2['title like']='%'.trim($_RQ['title']).'%';
		$jobid=pdo_getall('jy_51job_job',$params2,'id','id');
		$jobid=$jobid?array_keys($jobid):-1;
		$params['jobid']=$jobid;
		$return['params']['jobtitle']=$_RQ['jobtitle'];
	}
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_51job_toplog',$params,array($pindex,$psize),$total,$fields,'','id desc');
	foreach($list as &$item){
		$item['merchname']=pdo_getcolumn('jy_51job_merch',array('id'=>$item['merchid'],'uniacid'=>$_SESSION['uniacid']),'title');
		$item['jobtitle']=pdo_getcolumn('jy_51job_job',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['jobid']),'title');
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','edit'=>false,'list'=>array(
			array('name'=>'ordersn','title'=>'编号','type'=>'string'),
			array('name'=>'merchname','title'=>'企业','type'=>'string'),
			array('name'=>'jobtitle','title'=>'工作名称','type'=>'string'),
			array('name'=>'day','title'=>'置顶天数','type'=>'string'),
			array('name'=>'fee','title'=>'置顶费用','type'=>'string'),
			array('name'=>'ispay','title'=>'是否付费','type'=>'string'),
			array('name'=>'createtime','title'=>'时间','type'=>'time'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'status'),
		),'action'=>array(
		)),
		'search'=>array(
			array('name'=>'jobtitle','width'=>15,'title'=>'工作名称','type'=>'string'),
		)
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='del'){
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
	}else{
		$del=array();
	}
	if($_RQ['id']){
		$del[]=$_RQ['id'];
	}
	foreach($del as $id){
		$id=intval($id);
		if($id){
			pdo_delete('jy_51job_toplog',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));
		}
	}
	exi('删除成功！');
}
